
<!--修改线路-->
<template>
  <div>
    <el-card class="box-card">
    <el-form label-width="80px" style="text-align: left" inline>
      <div style="text-align: left">
        <el-form-item label="线路名称" prop="lineName">
          <el-input v-model="line.lineName" style="width: 290px"></el-input>
        </el-form-item>
      </div>
      <div style="text-align: left">
        <el-form-item label="出游天数" prop="days">
          <el-input v-model="line.days" style="width: 290px"></el-input>
        </el-form-item>
        <el-form-item label="线路价格" prop="price">
          <el-input v-model="line.price" style="width: 290px"></el-input>
        </el-form-item>
      </div>
      <div style="text-align: left ">
        <el-form-item label="出游工具" prop="vehicle">
          <el-select v-model="line.vehicle" placeholder="请选择" style="width: 290px">
            <el-option v-for="(item,index) in options" :key="index"
                       :label="item.label"
                       :value="item.label">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="线路类型" prop="lineTypeID">
          <el-select v-model="line.typeName" placeholder="请选择" style="width: 290px">
            <el-option
                v-for="(item,index) in type"
                :key="index"
                :label="item.name"
                :value="item.name">
            </el-option>
          </el-select>
        </el-form-item>
      </div>
      <div style="text-align: left">
        <el-form-item label="推荐理由" prop="arrange">
          <el-input type="textarea" v-model="line.reason"></el-input>
        </el-form-item>
        <el-form-item label="行程安排" prop="arrange">
          <el-input type="textarea" v-model="line.arrange"></el-input>
        </el-form-item>
        <el-form-item label="线路简介" prop="introduction">
          <el-input type="textarea" v-model="line.introduction"></el-input>
        </el-form-item>
      </div>
      <div>
        <el-button type="primary" plain @click="PutLine">确定修改</el-button>
        <el-button type="primary" plain @click="$router.push('/adminLine')">取消修改</el-button>
      </div>
    </el-form>
    </el-card>
  </div>
</template>

<script>
export default {
  name: "adminPutLine",
  data(){
    return{
      // putLine:{},
      lineType:{},
      // line:,
      line:this.$route.query.user,
      options: [
        {label: '飞机'}, {label: '游轮'}, {label: '大巴'},
        {label: '汽车'}, {label: '高铁'}],
      type:[{name:'境内游'},{name:'境外游'},{name:'海岛游'}]
    }
  }, created() {
    // this.getLine()
    this.getLineType()

  },

  methods:{
    // getLine:function(){
    //   this.$axios.get("/api/admin/line").then(res => {
    //     console.log(res.data)
    //     this.line=res.data
    //   })
    // },
    getLineType:function(){
      this.$axios.get("/api/admin/lineType").then(res => {
        this.lineType=res.data
      })
    },
    PutLine:function (){
      this.line.teamBuy=0;
      this.$axios.put("/api/admin/line", this.line).then(res => {
        this.$message.warning(res.data.msg);
        this.$router.push("/adminLine");
      })
    },
    handleRemove(file, fileList) {
      console.log(file, fileList);
    },
    handlePreview(file) {
      console.log(file);
    }
  },
}
</script>
<style>
.el-input__inner{

  padding: 0 5px;
}
.el-textarea{
  width: 290px;

}
.el-textarea__inner{
  padding: 0 5px;
}
</style>
<style scoped>

</style>